extends Node

signal score_updated(new_score)  # 明确声明信号

var score = 0
# 怪物血量倍数
var EnemyHpB = 0

var EnemyHpC = 1

# 定义定时器节点
@onready var timerAdd = Timer.new()

# 定义定时器节点
@onready var timerCheng = Timer.new()

func reset():
	score = 0  # 重置为初始值
	EnemyHpB = 0
	
func _ready() -> void:
	get_tree().paused = false
		# 设置定时器的等待时间为30秒
	timerAdd.wait_time = 5
	# 将定时器的timeout信号连接到自定义的_on_timer_timeout方法
	timerAdd.timeout.connect(_on_timerAdd_timeout)
	# 将定时器添加到当前节点
	add_child(timerAdd)
	# 启动定时器
	timerAdd.start()
	
		# 设置定时器的等待时间为30秒
	timerCheng.wait_time = 40
	# 将定时器的timeout信号连接到自定义的_on_timer_timeout方法
	timerCheng.timeout.connect(_on_timerCheng_timeout)
	# 将定时器添加到当前节点
	add_child(timerCheng)
	# 启动定时器
	timerCheng.start()
	
func add_score(points):
	score += points
	emit_signal("score_updated", score)  # 带参数发射



func _on_diff_up_timeout() -> void:
	pass # Replace with function body.
	
func _on_timerAdd_timeout():
	# 当定时器超时触发时，会执行此方法中的代码
	EnemyHpB += 1
	print("add passed!")

func _on_timerCheng_timeout():
	# 当定时器超时触发时，会执行此方法中的代码
	EnemyHpB = 2 * EnemyHpB
	print("40 seconds have passed!")
